<include file="Public/header" title="编辑会员信息" bdstyle="background:#f2f2f2;"/>
<include file="Public/header_back" showEdit="1"/> 
	<form id="dataForm">
	    <article class="data-wrap personal-data">
	        <h3>个人资料</h3>
	        <div class="data-input">
	            <section class="flex-align">
	                <span>手机号(账号)</span>
	                <span class="flex-1">{$user_info.user_name|default=$user_info.mobile_phone}</span>
	            </section>
	            <section class="flex-justify">
	                <span>姓名</span>
	                <span class="flex-1 right-icon">
						<input type="text" name="info[name]" value="{$user_info.name}"/>
					</span>
	            </section>
	            <section class="flex-justify">
	                <span>性别</span>
	                <span class="flex-1 right-icon">
	                <select name="info[sex]" style="background:none;">
	                <option value="0" {:$user_info.sex != '1'?'selected':''}>男</option>
	                <option value="1" {:$user_info.sex == '1'?'selected':''}>女</option>
	                </select>
	                </span>
	            </section>
	            <section class="flex-justify">
	                <span>联系人电话</span>
	                <span class="flex-1 right-icon">
					<input type="text" name="info[home_phone]" value="{$user_info.home_phone}"/>
					</span>
	            </section>
	            <section class="flex-justify">
	                <span>电子邮件</span>
	                <span class="flex-1 right-icon">
	                <input type="text" name="info[email]" value="{$user_info.email|default=$addr.email}"/>
	                </span>
	            </section>
	            <section class="flex-align identity">
	                <span>证件照<i></i></span>
	                <a href="javascript:see_example()" class="flex-1 see-sample">查看示例</a>
	            </section>
	            <div class="identity-upload clearfix">
	                <div class="upload-positive" <if condition="$user_data.becard neq ''">style="background:url({$user_data.becard}) no-repeat center;"</if>>
	                    <input type="file" id="becard" name="up_pic" onchange="uploadImg(this,upload_back)"/>
	                    <input type="hidden" name="user_data[becard]" value="{$user_data.becard}"/>
	                </div>
	                <div class="upload-other-side" <if condition="$user_data.bacard neq ''">style="background:url({$user_data.bacard}) no-repeat center"</if>>
	                    <input type="file" id="bacard" name="up_pic" onchange="uploadImg(this,upload_back)"/>
	                    <input type="hidden" name="user_data[bacard]" value="{$user_data.bacard}"/>
	                </div>
	                <div class="hand-id" <if condition="$user_data.holdcard neq ''">style="background:url({$user_data.holdcard}) no-repeat center;"</if>>
	                    <input type="file" id="holdcard" name="up_pic" onchange="uploadImg(this,upload_back)"/>
	                    <input type="hidden" name="user_data[holdcard]" value="{$user_data.holdcard}"/>
	                </div>
	            </div>
	            <section class="emergency-contact flex-justify">
	                <span>紧急联系人姓名</span>
	                <span class="flex-1 right-icon">
	                <input name="user_data[home_name]" value="{$user_data.home_name}"/>
	                </span>
	            </section>
	            <section class="flex-justify">
	                <span>紧急联系人电话</span>
	                <span class="flex-1 right-icon">
					<input type="text" name="info[home_phone]" value="{$user_info.home_phone}"/>
					</span>
	            </section>
	            <section class="flex-justify">
	                <span>邮编<em class="optional">(选填)</em></span>
	                <span class="flex-1 right-icon">
	                <input type="text" name="addr[zipcode]" value="{$addr.zipcode}"/>
	                </span>
	            </section>
	            <section class="invoice-list mail">
	                <h4>邮寄地址<em class="optional">(选填)</em></h4>
	                <textarea name="addr[address]" placeholder="请输入您的邮寄地址，我们会把文件通过邮寄的方式给到您">{$addr.address}</textarea>
	            </section>
	        </div>
	    </article>
	    <article class="data-wrap personal-data company-info">
	        <h3>企业信息<em class="optional">(选填)</em></h3>
	        <div class="contact"><i class="iconfont icon-gantanhao"></i>请完善您所在企业的信息，我们将为您提供企业服务</div>
	        <div class="data-input">
	            <section class="flex-align">
	                <span>公司名称</span>
	                <span class="flex-1">
	                <input type="text" name="cp[cp_name]" value="{$cp_data.cp_name}"/>
	                </span>
	            </section>
	            <section class="flex-justify">
	                <span>企业国籍</span>
	                <span class="flex-1 right-icon">
					<select name="cp[cp_type]" style="background:none;">
						<option value="0" {:$cp_data['cp_type'] != '0'?'selected':''}>中国境内</option>
						<option value="1" {:$cp_data['cp_type'] == '1'?'selected':''}>中国境外</option>
					</select>
					</span>
	            </section>
	            <section class="invoice-list refund-ticket">
	                <h4>企业注册地址</h4>
	                <textarea name="cp[re_address]">{$cp_data.re_address}</textarea>
	            </section>
	            <section class="flex-justify">
	                <span>企业机构代码</span>
	                <span class="flex-1 right-icon">
	                <input type="text" name="cp[cp_re_no]" value="{$cp_data.cp_re_no}"/>
	                </span>
	            </section>
	            <section class="flex-align identity">
	                <span>企业营业执照</span>
	            </section>
	            <div class="identity-upload clearfix">
	                <div class="upload" <if condition="$cp_data.cp_license neq ''">style="background:url({$cp_data.cp_license}) no-repeat center"</if>>
	                    <input id="cp_license" name="up_pic" type="file" onchange="uploadImg(this,upload_back)"/>
	                    <input name="cp[cp_license]" type="hidden" value="{$cp_data.cp_license}"/>
	                </div>
	            </div>
	        </div>
	    </article>
    </form>
    <a href="javascript:void(0)" onclick="save()" class="preservation">保存</a>
    
    <div id="example_pic" class="swiper-bj none">
		<div class="swiper-main">
			<div class="close" onclick="$('#example_pic').hide()"><img src="__PUBLIC__/home/images/close.png"/></div>
			<h3>照片示例</h3>
			<div class="swiper-container">
			  <div class="swiper-wrapper">
			    
				<div class="swiper-slide" style="background-image:url('__PUBLIC__/home/images/identity.jpg');"></div>
			  	
			  </div>
			</div>
			<div class="left-swipe"></div>
			<div class="right-swipe"></div>
		</div>
	</div>
<script>
function upload_back(data,id){
	console.log(data,id)
	if(data.status == '1'){
		$('#'+id).parent().css({'background':'url('+data.info+') no-repeat center','background-size':'cover'});
		$('#'+id).next('input').val(data.info);
	}else{
		layer.msg(data.info);
	}
}
var mySwiper = new Swiper('.swiper-container', {
	autoplay: 5000,//可选选项，自动滑动
})
function save(){
	$.post(
		'{:U("editInfo")}',
		$('#dataForm').serializeArray(),
		function(data){
			if(data.status == '1'){
				layer.msg(data.info);
				setTimeout(function(){
					location.href = data.url;
				},1000);
			}else{
				layer.msg(data.info);
			}
		}
	)
}
function see_example(){
	$('#example_pic').css("height","100%").show();
}
</script>
</body>
</html>


